Poi label names#115
Open
Hendrik-code wants to merge 3 commits into
Open
Conversation
POI.copy(), _set_inplace(), POI_Global.to_other(), and calc_poi_average() dropped the naming metadata (level_one_info, level_two_info, and with it info['label_name']), and POI_Descriptor.copy() dropped its name<->id definition. Now every copy/derive path preserves them, so names survive reorient/rescale/extract/map_labels/to_global/ average (all of which route through copy()). Verified preserved across those ops; 76 existing POI tests still pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
label_name now uses the nested form {region:{subregion:name,'name':group}} instead
of flat {'(1, 2)':'C2'}. Old flat files (and JSON string keys) are migrated on load
(normalize_label_name); saving always writes the new format (mrk.json export stays
byte-identical, fed from the nested dict). New accessors POI.label_name(region,
subregion) and POI.level_one_name(region) resolve custom names with priority over
level_two_info/level_one_info enum names (warning when a custom name diverges from a
given enum name); set_label_name/set_level_one_name write them. mrk/txt import and
join_left updated to the nested form. 89 POI tests + 8 new tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
unpack_poi_id now resolves a key part via level_one_info/level_two_info enum names (when set) before the descriptor's definition, so poi[idx, 'level2name'] and poi['level1name', 'level2name'] work for get/set/contains alongside ids and Enums. Using an Enum key while the matching level_*_info is still 'Any' (unset) now emits a warning (the .value is still used). 100 POI tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
|
Do not merge for the new release. Needs a lot of testing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Overhauls POI naming across
POIandPOI_Globalper the requested spec. Three focused commits; full unit suite 406 passed / 4 skipped (395 baseline + 11 new POI tests). Coloring/serialization of.mrk.jsonis kept byte-identical.What changed (mapped to the requirements)
POI.copy,_set_inplace,POI_Global.to_other,calc_poi_average, andPOI_Descriptor.copynow carrylevel_one_info/level_two_info/info/definition.Since reorient/rescale/extract/map_labels/to_global/average route through
copy(), the names follow.poi[idx, "level2name"]andpoi["level1name", "level2name"]work for get/set/in(viaunpack_poi_id→level_*_info._get_id→ descriptor definition), alongside ids and Enums..value; a warning fires when the matchinglevel_*_infois stillAny(unset).poi.level_one_name(region)— returns the group (level-one) name.poi.label_name(region, subregion)— returns the point name.set_label_name/set_level_one_namewrite them.label_nameformat —{region: {subregion: name, "name": group}}instead of flat{"(1, 2)": "C2"}.normalize_label_name()migrates the old flat form (and JSON string keys) on load;save always writes the new form.
.mrk.jsonexport/import stays byte-identical, now fed from the nested dict.join_left/txt-import updated.label_namewins over thelevel_x_infoenum name, with a warning when it diverges from a given enum name.Notes for reviewers
Location.save_as_name()isFalse(subregions saved as ints), so its_get_namereturns the id string — the accessor treats that as "no enum name" and falls back to the id/custom name.Vertebra_Instanceuses real names.(Tell me if you'd like
Locationto also resolve to enum names.)__getitem__/__setitem__/__contains__;extract_region/extract_subregion/removestill take ids+Enums (not yet level names) — easy to extend.unit_tests/test_poi_label_names.py(11 tests) locking migration, accessors, round-trip, old-format load, name indexing, warnings, and metadata transfer.Commits:
18d9096fix(poi): carry level_one_info/level_two_info/info through all POI ops38be00efeat(poi): nested label_name format + name accessors + migration3ab343dfeat(poi): index POIs by level names + warn on enum without level_*_info